import java.io.*;


public class FileIO {

	public static void main(String[] args) throws Exception {
		int i,len = 0;
		InputStream fin=new FileInputStream(new File("test.txt"));
		OutputStream fot=new FileOutputStream(new File("copy of test.txt"));
		try{
		
		while((i=fin.read())!=-1){
			fot.write(i);
			len++;
			
		}
		System.out.println(len + " bytes 복사성공!");
		}catch (Exception e) {
			System.out.print(e);
		}finally{
			
			fin.close();
			fot.close();
		}

	}

}
